# -*- coding: utf-8 -*-
#(c)Jonathan & Gregoire (read __doc__ for more information)
#Copyright (C)%(author)s (%(date)s)
#
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program.  If not, see <http://www.gnu.org/licenses/>.

## @packagename view
# It is a collection of view object for implement MVC pattern design

import time
import os
from engine.view.Color import Color

__author__      = \
"""
Jonathan MERCIER <bioinfornatics at gmail.com >
Gregoire NAUDIN  <greg.naudin at gmail.com    >

"""
__version__     = "$Revision: 0.1 $"
__date__        = "$Date: 2009/23/09$"
__copyright__   = "Copyright (c) 2009 Jonathan MERCIER and Gregoire NAUDIN"
__license__     = "GPL v3 or under"
__name__        = "Game_view.py"
__description__ = \
"""
Game_view is a class between the player and the pattern Game
"""

## Documentation for Human_view class
# Player_view is a class between the physical player and the pattern Human
class Game_view(object):
    ## The constructor
    # @param self: The pointer object
    def __init__(self):
        self.__player_list  = None
    
    ## Getter for the pointer game
    # @param self The object pointer
    # @return: self.__game pointer from the game object
    def get_game(self):
        return self.__game
    
    ## Setter for the pointer game    # @param self The object pointer
    # @param value: the newest pointer value from the game object
    def set_game(self,value):
        self.__game = value
    
    game = property(get_game,set_game)
    
    
    ## Public method logo
    # @brief It is a public method used for print a funny ascii art
    # @param self The object pointer
    def logo(self):
        color = Color()
        print u"Welcome in Pycol"
        print u"The card game that gives a headache\n\n"
        print u'\n\n'
        print color.yellow()+u'                          oooo$$$$$$$$$$$$oooo'+color.end()
        print color.yellow()+u'                      oo$$$$$$$$$$$$$$$$$$$$$$$$o',color.end()
        print color.yellow()+u'                   oo$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$o         o$   $$ o$'+color.end()
        print color.yellow()+u'   o $ oo        o$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$o       $$ $$ $$o$'+color.end()
        print color.yellow()+u'oo $ $ "$      o$$$$$$$$$    $$$$$$$$$$$$$    $$$$$$$$$o       $$$o$$o$'+color.end()
        print color.yellow()+u'"$$$$$$o$     o$$$$$$$$$      $$$$$$$$$$$      $$$$$$$$$$o    $$$$$$$$'+color.end()
        print color.yellow()+u'  $$$$$$$    $$$$$$$$$$$      $$$$$$$$$$$      $$$$$$$$$$$$$$$$$$$$$$$'+color.end()
        print color.yellow()+u'  $$$$$$$$$$$$$$$$$$$$$$$    $$$$$$$$$$$$$    $$$$$$$$$$$$$$  """$$$'+color.end()
        print color.yellow()+u'   "$$$""""$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$     "$$$'+color.end()
        print color.yellow()+u'    $$$   o$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$     "$$$o'+color.end()
        print color.yellow()+u'   o$$"   $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$       $$$o'+color.end()
        print color.yellow()+u'   $$$    $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" "$$$$$$ooooo$$$$o'+color.end()
        print color.yellow()+u'  o$$$oooo$$$$$  $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$   o$$$$$$$$$$$$$$$$$'+color.end()
        print color.yellow()+u'  $$$$$$$$"$$$$   $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$     $$$$""""""""'+color.end()
        print color.yellow()+u' """"       $$$$    "$$$$$$$$$$$$$$$$$$$$$$$$$$$$"      o$$$'+color.end()
        print color.yellow()+u'            "$$$o     """$$$$$$$$$$$$$$$$$$"$$"         $$$'+color.end()
        print color.yellow()+u'              $$$o          "$$""$$$$$$""""           o$$$'+color.end()
        print color.yellow()+u'               $$$$o                                o$$$"'+color.end()
        print color.yellow()+u'                "$$$$o      '+color.end()+color.red()+'o$$$$$$o"$$$$o'+color.end()+color.yellow(),'        o$$$$',color.end()
        print color.yellow()+u'                  "$$$$$oo     '+color.end()+color.red()+'""$$$$o$$$$$o'+color.end()+color.yellow(),'   o$$$$""',color.end()
        print color.yellow()+u'                     ""$$$$$oooo  '+color.end()+color.red()+'"$$$o$$$$$$'+color.end()+color.yellow(),'$$$"""',color.end()
        print color.yellow()+u'                        ""$$$$$$$oo '+color.end()+color.red()+'$$$$$$$$$$'+color.end()
        print color.yellow()+u'                                """"'+color.end()+color.red()+'$$$$$$$$$$$'+color.end()
        print color.yellow()+u'                                    '+color.end()+color.red()+'$$$$$$$$$$$$'+color.end()
        print color.yellow()+u'                                     '+color.end()+color.red()+'$$$$$$$$$$"'+color.end()
        print color.yellow()+u'                                      '+color.end()+color.red()+'"$$$""  '+color.end()
        # Wait 2 secondes
        time.sleep(2)
        os.system("clear")
    
    ## Public method ask_number_human_player
    # @brief It is a public method used for question player for know how many human player play
    # @param self The object pointer
    # @return: number_human_player
    def ask_number_human_player(self):
        print u"How many human player for this round?"
        print u"Your choice: ",
        number_human_player = input()
        return number_human_player

    ## Public method ask_number_computer_player
    # @brief It is a public method used for question player for know how many computer player play
    # @param self The object pointer
    # @return: number_computer_player
    def ask_number_computer_player(self):
        print u"How many computer player for this round?"
        print u"Your choice: ",
        number_computer_player = int(input())
        return number_computer_player
    
    # Public method menu
    # @brief it is the main game menu
    # @return choice
    def menu(self):
        print u"-"*40
        print u"Choose an action"
        print u"Enter 1 to do a round with human only"
        print u"Enter 2 to do a round with human and computer"
        print u"Enter 3 to exit"
        print u"Your choice: ",
        try:
            choice = input()
        except NameError:
            choice = None
        except  SyntaxError:
            choice = None
        print u"-"*40
        return choice
    
